package com.migu.rbac.test.word;

import org.apache.commons.lang.StringUtils;
import org.junit.jupiter.api.Test;

/**
 * @Author: zhaojie
 * @CreateDate: 2019/10/23
 * @Description:
 */
public class test {
    public static void main(String[] args) {
        SensitivewordFilter filter = new SensitivewordFilter();
        String s = maskEmail("23@qq.com");
        System.out.println(s);
        int sc = filter.CheckSensitiveWord("港独", 0,1);
        System.out.println(sc);
    }

    public static String maskEmail(String email) {
        if (StringUtils.isEmpty(email)) {
            return email;
        }
        return email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)", "$1***$3$4");
    }


}
